package org.example.commonapi.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.example.commonapi.domain.Practice;

import java.time.LocalDateTime;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class PracticeDto {
    private Long id;

    /**
     * 试题名称
     */
    private String name;

    /**
     * 试题题目
     */
    private String content;

    /**
     * 出题人id
     */
    private Long teacherId;


    /**
     * 题目难度
     */
    private Integer difficulty;

    /**
     * 题目类型 0-单选 1-多选 2-判断 3-填空 4-简答
     */
    private Integer type;

    /**
     * 题目所属专业
     */
    private String subject;

    /**
     * 题目图片（practice_image表）
     */
    private List<String> images;

    /**
     * 题目答案
     */
    private String answer;

    /**
     * 最新更新时间
     */
    private LocalDateTime updateTime;


    public PracticeDto(Practice practice) {
        this.id = practice.getId();
        this.name = practice.getName();
        this.content = practice.getContent();
        this.teacherId = practice.getTeacherId();
        this.difficulty = practice.getDifficulty();
        this.type = practice.getType();
        this.subject = practice.getSubject();
        this.answer = practice.getAnswer();
    }
}
